#include "head.h"
/* Usage:  */
int socket_init(int*socket_fd,char* port,char*ip)
{

   *socket_fd=socket(AF_INET,SOCK_STREAM,0);

   struct sockaddr_in sockaddr;
   sockaddr.sin_family=AF_INET;
   sockaddr.sin_port=htons(atoi(port));
   sockaddr.sin_addr.s_addr=inet_addr(ip);

   int ret= connect(*socket_fd,(struct sockaddr*)&sockaddr,sizeof(sockaddr));
   //ERROR_CHECK(ret,-1,"connect");
   if(ret==-1)
   {
       exit(0);
   }
   return 0;
}

